<template>
  <div class="hot-recommend">
    <div class="hot-recommend-title">
      <button class="hot-recommend-title-button">热门推荐</button>
    </div>
    <div class="hot-recommend-content">
      <el-row :gutter="10" type="flex" justify="space-between">
        <el-col
          v-for="hotClass in hotClassList"
          :key="hotClass.id"
          :span="6"
        ><el-image v-if="hotClass.id" :fit="fit" :src="hotClass.url" @click="handleImg(hotClass.class_id)" /></el-col>

      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fit: 'fill',
      hotClassList: []
    }
  },
  mounted() {
    this.getHotClass()
  },
  methods: {
    async getHotClass() {
      const { data } = await this.$API.home.getHotClass()
      this.hotClassList = data
    },
    handleImg(classId) {
      this.$router.push({
        name: 'ClassInfo',
        query: {
          classId
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.hot-recommend {
  margin-top: -25px;
  .hot-recommend-title {
    width: 100%;
    height: 2px;
    border: 2px solid rgb(56, 155, 74);
    display: flex;
    justify-content: center;
    align-items: center;
    .hot-recommend-title-button {
      font-size: 20px;
      width: 140px;
      height: 60px;
      border-radius: 15px;
      color: rgb(242, 242, 242);
      background-color: rgb(91, 152, 207);
      border: 0;
    }
  }
  .hot-recommend-content{
      margin-top:50px;
      overflow-y: hidden;
      .hot-recommend-content-img{
          width: 200px;

      }
  }
}
</style>
